package first

class Person {

    String name
    int age
    Address address;


    static constraints = {

        name matches: /^[a-zA-Z][a-zA-Z0-9-_\.]{1,20}$/
        age matches: /[0-9]/

    }

    static hasOne = [address: Address]


    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", version=" + version +
                ", address=" + address +
                '}';
    }
}
